/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ih_base_platform;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author Melvin
 */
public class DbConnection {

    //Parametros de conexion
    String NameBase = "ubicacion";
    String login = "root";
    String password = "melgutierrez";
    String url = "jdbc:mysql://localhost/" + NameBase;

    Connection connection = null;


    public DbConnection() {

        try {
            Class.forName("com.mysql.jdbc.Driver");
            connection = DriverManager.getConnection(url, login, password);
            if (connection != null) {
                System.out.println("Conexion a Base de Datos: " + NameBase + " Exitosa");
            }

        } catch (ClassNotFoundException | SQLException e) {
            System.out.println(e);
        }
    }

    public Connection getConnection() {
        return connection;
    }

    public void disconnect() {
        connection = null;
    }


}
